home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12262 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: news.spies.com!usenet
  2. From: Erik Max Francis <max@alcyone.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Is there a problem using memset on a malloc'd memory in HP-C
  5. Date: Fri, 29 Mar 1996 14:22:59 -0800
  6. Organization: Alcyone Systems
  7. Message-ID: <315C62C3.677EF741@alcyone.com>
  8. References: <31a7cc$10b20.32c@NEWS>
  9. NNTP-Posting-Host: newton.alcyone.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.01 (X11; I; Linux 1.2.13 i486)
  14.  
  15. Jonathan Julian wrote:
  16.  
  17. > I am having trouble doing a malloc on memory that I allocated via
  18. > malloc.  I malloc'd the memory, memset it  and immediately look at it
  19. > and it is garbage.  I have changed my mallocs to callocs, but later in
  20. > my code I realloc.  Since realloc does not initialize and I
  21. > distrusting of memset I have written a loop to initialize my memory.
  22.  
  23. It's possible that it's a bug in your standard libraries, but more likely it's
  24. just something subtly wrong that you're doing.  Take the code which causes the
  25. problem and strip it down to its simplest form, then ask again with a code
  26. fragment which demonstrates the problem.
  27.  
  28. -- 
  29. Erik Max Francis &tSftDotIotE && http://www.alcyone.com/max && max@alcyone.com
  30. San Jose, California, U.S.A. && 37 20 07 N 121 53 38 W && the 4th R is respect
  31. H.3`S,3,P,3$S,#$Q,C`Q,3,P,3$S,#$Q,3`Q,3,P,C$Q,#(Q.#`-"C`- && 1love && folasade
  32. Omnia quia sunt, lumina sunt. && Dominion, GIGO, GOOGOL, Omega, Psi, Strategem
  33. "Out from his breast/his soul went to seek/the doom of the just." -- _Beowulf_
  34.